package com.sjb.singleequipment;

import cn.hutool.http.server.HttpServerRequest;
import com.sjb.singleequipment.model.User;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Profile;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

/**
 * @Author:sjb
 * @CreateTime:2024-08-18
 * @Description: 用户web层
 * @Version：1.0
 */
@RestController
@RequestMapping("/user/mock")
@Profile({"local","dev"})
@Slf4j
public class UserMockController {

    @Resource
    private SessionManager sessionManager;

    @PostMapping("/login")
    public User userLoginMock(HttpServletRequest request){
        User user = new User();
        user.setId(1L);
        sessionManager.login(user,request);
        log.info("user login succeed ,id = {}",user.getId());
        return user;
    }

}
